package com.bytz.modules.cms.productLine.service.impl;

import cn.hutool.core.collection.CollectionUtil;
import com.bytz.modules.cms.productLine.entity.ProductLineLevel;
import com.bytz.modules.cms.productLine.mapper.ProductLineLevelMapper;
import com.bytz.modules.cms.productLine.service.IProductLineLevelService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

/**
 * <p>
 * 莱宝CMS—产品线管理—产品线等级折扣表 服务实现类
 * </p>
 *
 * @author KyleWang
 * @since 2022-10-10
 */
@Service
public class ProductLineLevelServiceImpl extends ServiceImpl<ProductLineLevelMapper, ProductLineLevel> implements IProductLineLevelService {

    @Override
    public List<ProductLineLevel> getByIds(Collection<String> ids) {

        if (CollectionUtil.isEmpty(ids)) {

            return new ArrayList<>();
        }

        return lambdaQuery().in(ProductLineLevel::getId, ids).list();
    }

    @Override
    public List<ProductLineLevel> getByNames(Collection<String> lineLevelNames) {

        if (CollectionUtil.isEmpty(lineLevelNames)) {

            return new ArrayList<>();
        }

        return lambdaQuery().in(ProductLineLevel::getLevelName, lineLevelNames).list();
    }
}